package com.jy.unkown.AD;

import android.app.Activity;
import android.view.ViewGroup;

import com.jy.common.BaseApplication;
import com.jy.unkown.entity.UnKownADType;
import com.jy.unkown.entity.UnkownSlotBean;
import com.jy.unkown.view.UnkownADView;
import com.jy.unkown.view.UnkownSplashView;
import com.jy.utils.utils.UI;

public class UnkownSplashAd extends BaseUnkownAd {
    @Override
    public UnkownSlotBean getUnkownSoltReqBean(UnkownSlotBean unkownSlotBean) {
        unkownSlotBean.slotheight =  1920 ;
        unkownSlotBean.slotwidth = 1080;
        return unkownSlotBean;
    }

    @Override
    int getAdType() {
        return UnKownADType.SPLASH;
    }

    @Override
    public UnkownADView getADView(Activity activity) throws Exception {
        throw  new Exception("不能调用此方法");
    }

    public void showAD(ViewGroup viewGroup) {
        Activity activity = (Activity) viewGroup.getContext();
        try {


            UnkownSplashView unkownSplashView = new UnkownSplashView(activity);
            unkownSplashView.setUnkownAd(unkownAdBean);
            unkownSplashView.setAdCallBack(adCallBack);

            viewGroup.addView(unkownSplashView,new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
            unkownSplashView.show();
        } catch (Exception e) {
            e.printStackTrace();
             if (adCallBack!=null){
                 adCallBack.err();
             }
        }
    }
}
